package logging;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

public class LogSystem {

	String _path;
	List<Themes> _themes;
	
	public LogSystem(String path,String name){
		_path = path;
		_themes = new ArrayList<Themes>();
		createSpace(name);
	}

	private void createSpace(String name) {
		File f = new File(_path + "/" + name);
		f.mkdir();
		_path += "/" + name;
	}
	
	public void addThemeFolder(Themes theme){
		File f = new File(_path + "/" + theme);
		f.mkdir();	
	}
	
	public void saveFile(Themes theme, String name, byte[] data){
		addThemeFolder(theme);
		File f = new File(_path + "/" + theme + "/" + name);
		try{
			OutputStream os = new FileOutputStream(f,true);		
			if(f.exists()){
				os.write(data);
			}else{
				os.write(data);
			}
			os.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
